import { FormSchema } from '/@/components/Table';
export const columns = [
  {
    title: '合同编号',
    dataIndex: 'contractTypeCode',
  },
  {
    title: '合同名称',
    dataIndex: 'fileName',
  },
  {
    title: '返回结果',
    dataIndex: 'responseCode',
    customRender: function ({ text }) {
      if (text == 500) {
        return '失败';
      } else if (text == 200) {
        return '成功';
      }
    },
  },
  {
    title: '返回信息',
    dataIndex: 'responseMessage',
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
  },
];
export const searchFormSchema: FormSchema[] = [
  {
    field: 'contractTypeCode',
    label: '合同编号',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: 'fileName',
    label: '合同名称',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: '返回结果',
    field: 'responseCode',
    component: 'JDictSelectTag',
    componentProps: {
      options: [
        {
          label: '成功',
          value: 200,
          key: '1',
        },
        {
          label: '失败',
          value: 500,
          key: '0',
        },
      ],
    },
  },
];
/**
 * 角色用户搜索form
 */
export const searchUserFormSchema: FormSchema[] = [
  {
    field: 'username',
    label: '用户账号',
    component: 'Input',
    colProps: { span: 12 },
    labelWidth: 74,
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'id',
    label: '',
    component: 'Input',
    show: false,
  },
  {
    field: 'contractTypeCode',
    component: 'Input',
    label: '合同类型',
    helpMessage: ['ApiSelect组件', '远程数据源本地搜索', '只发起一次请求获取所有选项'],
    required: true,
    slot: 'localSearch',
    colProps: {
      span: 8,
    },
    defaultValue: '0',
  },
  {
    field: 'file',
    component: 'JUpload',
    helpMessage: '最多上传1个文件',
    label: '合同文件',
    componentProps: { maxCount: 1 },
  },
];

export const formDescSchema = [
  {
    field: 'roleName',
    label: '角色名称',
  },
  {
    field: 'roleCode',
    label: '角色编码',
  },
  {
    label: '备注',
    field: 'description',
  },
];

export const modelFormSchema: FormSchema[] = [
  {
    label: 'APIkey',
    field: 'apiKey',
    component: 'Input',
    required: true,
    helpMessage: '请输入APIkey',
  },
];
